<?php
class App_Model_Mail
{
	private $mail=null;
	private $transport=null;
	
	public function __construct($code='utf-8')
	{
		$this->mail=new Zend_Mail($code);
			
		$EMAIL_HOST='smtp.ym.163.com';
		$EMAIL_NAME='admin@taotens.com';
		$EMAIL_PASSWORD='qa1234';
		
		$config = array('auth' => 'login',
            			'username' => $EMAIL_NAME,
            			'password' => $EMAIL_PASSWORD
    					);
    	
    	$this->transport = new Zend_Mail_Transport_Smtp($EMAIL_HOST,$config);
	}
	
    /**发送邮件*/
	public function sendEmail($from_email,$to_email,$subject,$content)
	{
		$this->mail=new Zend_Mail('utf-8');
		try{
			$this->mail->setBodyHtml($content);
			$this->mail->setFrom($from_email,"=?UTF-8?B?".base64_encode('Taotens项目管理系统')."?=");
			$this->mail->addTo($to_email);
			$this->mail->setSubject("=?UTF-8?B?".base64_encode($subject)."?=");
			$this->mail->send($this->transport);
		}catch(Exception $e){
			return $e->getMessage();
		}
		
		return 'success';
	}
	
}